<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>列表渲染</title>
  </head>
  <body>
    <div id="app">
      <!-- v-for指令用于做循环渲染 -->
      <!-- 哪个元素要循环，就给哪个元素添加v-for -->
      <!-- item表示的是每一项，形参 -->
      <ul>
        <li v-for="value in list">{{ value }}</li>
      </ul>

      <!-- <p>学习 JavaScript</p>
      <p>学习 Vue</p>
      <p>整个牛项目</p> -->
      <p v-for="item in todos">{{ item.text }}</p>
    </div>

    <script src="../../Vue.js"></script>
    <script>
      const vm = new Vue({
        el: "#app",
        data: {
          list: [1, 2, 3],
          todos: [
            { text: "学习 JavaScript" },
            { text: "学习 Vue" },
            { text: "整个牛项目" },
          ],
        },
      });
    </script>
  </body>
</html>
